<div ng-app="accountApp" ng-controller="accountController">
    <div class="mainbox col-md-7 col-md-offset-2 col-sm-8 col-sm-offset-2">
        <?php if($message): ?>
        <div class="alert alert-success alert-dismissable">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <?php print $message; ?>
        </div>       
        <?php endif; ?>
        <form action="<?php print base_url() . 'user/account/' . $param;?>" method="post" id="accountForm" name="accountForm" class="form-horizontal" role="form" novalidate>   
            <div class="form-group" ng-class="{ 'has-error' : accountForm.full_name.$error.required && submitted}">
                <label for="password" class="col-md-3">Họ tên</label>
                <div class="col-md-9">
                    <input type="text" class="form-control" name="full_name" value="<?php print $data['full_name'];?>" ng-model="account.full_name"  ng-init="account.full_name='<?php print $data['full_name'];?>'" required>
                    <p ng-show="submitted && accountForm.full_name.$error.required" class="help-block">Họ tên không được để trống.</p>
                </div>
            </div>
            <div class="form-group" ng-class="{ 'has-error' : accountForm.email.$error.required && submitted || submitted && accountForm.$error.email}">
                <label for="email" class="col-md-3">Email</label>
                 <div class="col-md-9">
                     <input id="account-email" type="email" class="form-control"  name="email" value="<?php print $data['email'];?>" ng-model="account.email"  ng-init="account.email='<?php print $data['email'];?>'" required placeholder="" >       
                    <p ng-show="submitted && accountForm.email.$error.required" class="help-block">Email không được để trống.</p>          
                    <p ng-show="submitted && accountForm.$error.email" class="help-block">Email không hợp lệ.</p>
                </div>                                                             
            </div>

            <div class="form-group" ng-class="{ 'has-error' : accountForm.password.$error.required && submitted || submitted && accountForm.password.$error.minlength || submitted && accountForm.password.$error.invalid}">
                <label for="password" class="col-md-3">Giới tính</label>
                <div class="col-md-9">
                    <select class="form-control" name="sex" ng-model="account.sex">
                        <option value="">Lựa chọn</option>
                        <option value="male" selected="selected">Nam</option>
                        <option value="female">Nữ</option>
                    </select>                   
                </div>
            </div>

            <div class="form-group" ng-class="{ 'has-error' : accountForm.password.$error.required && submitted || submitted && accountForm.password.$error.minlength || submitted && accountForm.password.$error.invalid}">
                <label for="password" class="col-md-3">Ngày sinh</label>
                <div class="col-md-9">
                    <div class="row">
                        <div class="col-xs-4">
                            <select class="form-control " name="day_birth" ng-model="account.day_birth">
                                <option value="">-</option>
                                <?php for($i = 1 ; $i <= 31; $i++):?>
                                <option value="<?php print $i;?>"><?php print $i;?></option>
                                <?php endfor; ?>                       
                            </select>
                        </div>
                        <div class="col-xs-4">
                            <select class="form-control" name="month_birth" ng-model="account.month_birth">
                                <option value="">-</option>
                                <?php for($i = 1 ; $i <= 12; $i++):?>
                                <option value="<?php print $i;?>"><?php print $i;?></option>
                                <?php endfor; ?>                       
                            </select>
                        </div>
                        <div class="col-xs-4">
                            <select class="form-control" name="year_birth" ng-model="account.year_birth">
                                <option value="">-</option>
                                <?php for($i = 1900 ; $i <= 2014; $i++):?>
                                <option value="<?php print $i;?>"><?php print $i;?></option>
                                <?php endfor; ?>                       
                            </select>     
                        </div>
                    </div>                    
                </div>
            </div>
            
            <div style="margin-top:10px" class="form-group">
                <!-- Button -->

                <div class="col-sm-12 controls">
                    <div class="form-group">
                        <!-- Button -->                                        
                        <div class="col-md-offset-3 col-md-9">
                            <button ng-disabled="loadingTracker.active()" data-ng-click="accountIndexProcess(accountForm)" id="btn-signup" type="submit" class="btn btn-info" data-style="zoom-in">
                                <span class="ladda-label">Lưu lại</span>                                               
                            </button>
                            <span ng-show="loadingTracker.active()" id="ajax-loading" class="ajax-loading margin-9"></span>
                        </div>
                    </div>
                </div>
            </div>
        </form>     
    </div>
</div>